﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class GameBoard : Form
    {

        Game game;

        public GameBoard()
        {
            InitializeComponent();
            game = new Game(this);
            cellTable.RowCount = Game.rowSize;
            cellTable.ColumnCount = Game.rowSize;
            
            for (int i = 0; i < Game.fieldSize; i++)
            {
                FeefteenCell cell = new FeefteenCell(game, i);
                game.cells.Add(cell);
            }

            fillCells();
            //cellTable.Controls.Add(new Label() { Text = "Type:", Anchor = AnchorStyles.None , AutoSize = true }, 0, 1);
        }

        public void clear()
        {
            cellTable.Controls.Clear();
        }

        public void fillCells()
        {
            clear();

            for (int i = 0; i < Game.fieldSize; i++)
            {
                cellTable.Controls.Add(game.cells[i], i % Game.rowSize, i / Game.rowSize);

            }
        }
    }
}
